{include file="common/_meta" /}
<title>用户管理</title>
<meta name="keywords" content="李志立，lizhilimaster@163.com">
<meta name="description" content="李志立，lizhilimaster@163.com">
</head>
<body>
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span>
		用户关系图 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);"
		 title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">

		<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">下一级关系图</span> <span class="r"></span> </div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-hover table-bg table-sort">
				<div>
					{volist name="user" id="vo"}
					<ul class="tree"><span class="co" onclick="cha(this,{$vo.id})">[+]</span>{$vo.name ? $vo.name : $vo.phone}</ul>
					{/volist}
				</div>
			</table>

		</div>
	</div>
	{include file="common/_footer" /}
	<style>
		.tree{
			line-height: 2;
			border-left: 2px solid #70cffa;
			margin-left: 25px;
			padding-left: 10px;
		}
		.co{
			margin: 0 5px;
			cursor:pointer;
		}
	</style>
	<script type="text/javascript">
		/*用户-添加*/
		function user_add(title, url, w, h) {
			layer_show(title, url, w, h);
		}
		/*管理员-启用*/
		function cha(obj, id) {
			$.post(
			"{:url('user/ajax')}", {
				id: id,
				type: 'user_fid',
			},
			function(res) {
				if($(obj).html()=='[-]'){
					$(obj).html('[+]')
					$(obj).parent().find('ul').remove()
				}else{
					let html=''
					for (const v of res) {
						let w=v.name
						if(!w){
							w=v.phone
						}
						html+=`<ul class="tree"><span class="co" onClick="cha(this,${v.id})">[+]</span>${w}</ul>`
					}
					$(obj).html('[-]')
					$(obj).parent().append(html);
				}
			});
		}
	</script>
</body>
</html>
